package com.biz.primus.ms.commodity.trans;

import com.biz.primus.ms.commodity.dao.po.DepotProduct;
import com.biz.primus.ms.commodity.dao.ro.DepotProductRo;
import com.google.common.base.Function;
import javax.annotation.Nullable;


/**
 * Created by jiangnan on 2017/6/23.
 */
public class DepotProduct2DepotProductRo implements Function<DepotProduct, DepotProductRo> {
    @Nullable
    @Override
    public DepotProductRo apply(@Nullable DepotProduct input) {
        DepotProductRo respVo = new DepotProductRo();
        if (input.getProduct() == null) {
            return null;
        }
        respVo.setId(input.getProduct().getProductCode() + input.getDepotCode());
        respVo.setDepotProductOrder(Integer.valueOf(input.getDepotProductOrder()));
        respVo.setDepotCode(input.getDepotCode());
        respVo.setProductCode(input.getProduct().getProductCode());
        return respVo;
    }
}
